{include file="public/head" /}
<div class="layui-fluid" style="top: 1rem;">
    <div class="layui-row">
        <form class="layui-form">
            <input type="hidden" id="id" name="id" required="" value="{$admin.id?$admin.id:''}"
                   lay-verify="id" autocomplete="off" class="layui-input">
            <div class="layui-form-item">
                <label for="password" class="layui-form-label">
                    旧密码</label>
                <div class="layui-input-inline">
                    <input type="password" id="oldpass" name="oldpwd" lay-verify="pass" autocomplete="off" class="layui-input"></div>
            </div>
            <div class="layui-form-item">
                <label for="password" class="layui-form-label">
                    密码</label>
                <div class="layui-input-inline">
                    <input type="password" id="password" name="password" lay-verify="pass" autocomplete="off" class="layui-input"></div>
                <div class="layui-form-mid layui-word-aux">6到16个字符</div></div>
            <div class="layui-form-item">
                <label for="repass" class="layui-form-label">
                    确认密码</label>
                <div class="layui-input-inline">
                    <input type="password" id="repass" name="repwd" lay-verify="repass" autocomplete="off" class="layui-input"></div>
            </div>
            <div class="layui-form-item">
                <label for="repass" class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="add" lay-submit="">保存</button></div>
        </form>
    </div>
</div>
</body>
<script>layui.use(['form', 'layer','jquery'],
    function() {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        //监听提交
        form.on('submit(add)',
            function(data) {
                $.ajax({
                    type: "POST",
                    url: "{:getUrl()}login/updatePwd",
                    data: data.field,
                    dataType: "json",
                    success: function(data){

                        if(data.code == 200)
                        {
                            layer.msg(data.msg, {icon: 6},function(){
                                //关闭当前frame
                                xadmin.close();
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            });
                        }else {
                            layer.msg(data.msg,{icon: 5,time:1000});
                        }
                    }
                });

                return false;
            });

    });</script>
</html>